import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entity/User';
import { UserController } from './controller/user.controller';
import { UserService } from './service/user.service';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmConflgService } from './service/typeOrmConfig.service';
import database from './config/database';

@Module({
    imports: [
        TypeOrmModule.forRootAsync({
            useClass: TypeOrmConflgService,
        }),
        TypeOrmModule.forFeature([User]),
        ConfigModule.forRoot({
            isGlobal: true,
            load: [database],
        }),
    ],
    controllers: [UserController],
    providers: [UserService],
    exports: [],
})
export class CoreMoudle {}
